<?php
namespace app\admin\auth;

use app\BaseController;
use think\facade\View;
use think\facade\Request;
use think\captcha\facade\Captcha;

class Auth
{
	static $error = [];
    // 初始化
    public static function check()
    {
        $extra = \think\facade\Config::get('extra');
        $ca = Request::controller().'/'.Request::action();
        if(in_array($ca, $extra['auth_allow']))
        {
        	return true;//免检接口允许进入
        }
        return self::chkAuth();
    }
    public static function chkLogin()
    {
    	//检查登录状态
    	return true;
    }
    public static function chkAuth()
    {
    	if(!self::chkLogin()){
    		self::$error[] = '请先登录';
    		return false;
    	}
    	//查询权限列表
    	//如果有部门结构检查上下级权限关系
        return false;
    }
    public static function error()
    {
    	return self::$error;
    }
    //部门人员管理权限
    public static function department()
    {
        self::chkson();
    }
    public static function chkson()
    {
        return true;
    }

}
